﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class DropDown : MonoBehaviour {
    public KeyCode current_code = KeyCode.None;
    public GameObject text_explain;
    public List<string> name_forward = new List<string>() {"W", "A","S","D" ,"Up Arrow","Down Arrow","Left Arrow","Right Arrow","Space","J"};
    List<KeyCode> key_code = new List<KeyCode>() { KeyCode.W, KeyCode.A, KeyCode.S, KeyCode.D, KeyCode.UpArrow, KeyCode.DownArrow, KeyCode.LeftArrow, KeyCode.RightArrow, KeyCode.Space, KeyCode.J };
    //List<string> name_backward = new List<string>() {"W", "A", "S", "D", "Up Arrow", "Down Arrow", "Left Arrow", "Right Arrow" };
    //List<string> name_turnleft = new List<string>() {"W", "A", "S", "D", "Up Arrow", "Down Arrow", "Left Arrow", "Right Arrow" };
    //List<string> name_turnright = new List<string>() { "W", "A", "S", "D", "Up Arrow", "Down Arrow", "Left Arrow", "Right Arrow" };

    public  Dropdown dp_forward;
    public int nale = 0;
    public static DropDown _DropDown;
    private void Awake()
    {
        _DropDown = this;
    }
    //public Dropdown dp_backward;
    //public Dropdown dp_turnleft;
    //public Dropdown dp_turnright;
    public KeyCode get_current_code()
    {
        return current_code;
    }

    public Text tt;
	// Use this for initialization
	void Start () {
         
        updatDps();


    }
   public void updatDps()
    {
        dp_forward.AddOptions(name_forward);
        //dp_backward.AddOptions(name_backward);
        //dp_turnleft.AddOptions(name_turnleft);
        //dp_turnright.AddOptions(name_turnright);

    }
    public void getKeyCode(int index)
    {
        
        current_code = key_code[index];
        tt.text = name_forward[index];
        GameObject.Find("Text_Apply").GetComponent<Text>().text = text_explain.GetComponent<Text>().text+": " + tt.text + " OK!";
    }
	// Update is called once per frame
	void Update ()
    {
        

    }
}
